<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');



class Gadgetdetails extends CI_Controller{

    public function __construct() {
        parent::__construct();
        $this->load->library('acl_auth');
    }
    
    /**
     * Only login user have access on this one
     */
	public function index()
	{	        
        if ($this->acl_auth->has_role('admin')){
            redirect('admin/lists'); // Admin must go to admin page.
        }
        $this->acl_auth->restrict_access('logged_in');
        $passExpired = $this->acl_auth->isPasswordExpired();
        if (!$this->session->userdata('logged') || $passExpired){
             // User Not yet login. Need to change password.
            if ($passExpired){
                $this->session->set_flashdata('message', $this->acl_auth->get_message("password_expired"));
            }             
             redirect("user/changePassword");
         }
                
        // For use not to edit the JS file everytime.
        // I better save the base url on the cookie
        $cookie = array(
            'name'   => 'burl',
            'value'  => base_url(''),
            'expire' => '86500',
            //'domain' => '.some-domain.com',
            'path'   => '/',
            'prefix' => 't_',
            //'secure' => TRUE
        );
        $this->input->set_cookie($cookie);
        
        // Load the price_range_mode.php
        $this->load->model('price_range_model');

        
        //landing page
        $d['hello'] ='data';
        $d['price_ranges'] =$this->price_range_model->getall();
        $views['_content'] = 'gadgetdetails';
        $this->template->load('template_landing', $views, $d);

	}

}
